import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);
//导入组件
import Login from "../views/Login.vue";
import Main from "../views/Main.vue";
import Register from "../views/Register.vue";
//二级路由组件
import Home from "../views/Home/Home.vue";
import ArtCate from "../views/Article/ArtCate.vue";
import ArtList from "../views/Article/ArtList.vue";
import UserInfo from "../views/User/UserInfo.vue";
import UserAvatar from "../views/User/UserAvatar.vue";
import UserPwd from "../views/User/UserPwd.vue";
const routes = [
  { path: "/", redirect: "/main" },
  {
    path: "/main",
    component: Main,
    children: [
      { path: "/", redirect: "/home" },
      { path: "/home", component: Home },
      { path: "/art-cate", component: ArtCate },
      { path: "/art-list", component: ArtList },
      { path: "/user-info", component: UserInfo },
      { path: "/user-avatar", component: UserAvatar },
      { path: "/user-pwd", component: UserPwd },
    ],
  },
  { path: "/login", component: Login },
  { path: "/register", component: Register },
];

const router = new VueRouter({
  routes,
});

export default router;
